﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace automata
{
    public partial class Form2 : Form
    {
        private int balance;
        public Form2(int balance)
        {
            InitializeComponent();
            this.balance = balance;
            label1.Text = balance.ToString();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked == true && balance >= 50)
            {
                MessageBox.Show("Sikeres tranzakció");
                balance = balance - 50;
            }
            else if(radioButton2.Checked==true && balance >=100)
            {
                MessageBox.Show("Sikeres tranzakció");
                balance = balance - 100;
            }
            else if (radioButton3.Checked == true && balance >= 200)
            {
                MessageBox.Show("Sikeres tranzakció");
                balance = balance - 200;
            }
            else
            { MessageBox.Show("Nincs elegendő pénz a számláján"); }
            label1.Text = balance.ToString();
        }


        private void button2_Click(object sender, EventArgs e)
        {
            Close();

        }

        public int Get_balance()
        {
            return balance;
        }
    }
}
